

export default {
	props: {
		url: String,
		replace: Boolean
	},
	methods: {
		route(config) {
			const { url, replace, success, fail, complete } = config;
			if (url) {
				let toParams = {
					url
				};
				if (success) toParams.success = success;
				if (fail) toParams.fail = fail;
				if (complete) toParams.complete = complete;

				if (replace) {
					uni.redirectTo(toParams);
				} else {
					uni.navigateTo(toParams);
				}
			}
		}
	}
};
